<template>
  <div :class="`vx6-widget ${disabled ? '' : 'enabled'}`" @click="$emit('click')">
    <div class="wapper">
      <slot></slot>
      <img v-if="icon" class="icon" :src="icon" />
    </div>
    <label>{{ label }}</label>
  </div>
</template>

<script setup lang="ts">
interface IProps {
  label: string
  icon?: string
  disabled?: boolean
}

withDefaults(defineProps<IProps>(), {
  label: '',
  icon: undefined,
  disabled: false
})
</script>

<style lang="scss" scoped>
.vx6-widget {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  border-radius: 5px;

  &.enabled {
    cursor: pointer;
    &:hover {
      background-color: #00000010;
    }
    &:active {
      background-color: #00000020;
    }
  }

  .wapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 22px;
  }

  label {
    display: inline-block;
    font-size: 12px;
    text-wrap: nowrap;
    line-height: 18px;
    text-align: center;
    font-weight: 400;
    margin-top: 4px;
  }
}
</style>
